package com.test.echarts.demo.controller;

import com.test.echarts.demo.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @GetMapping("/index")
    public  String index()
    {
        return "echarts-demo";
    }
    @RequestMapping("/echarts_ajax")
    @ResponseBody
    public List<User> echart_ajax()
    {
        List<User> userList=new ArrayList<>();
        userList.add(new User("Peter",8000.0));
        userList.add(new User("张三",6000.0));
        userList.add(new User("李四",5000.0));
        userList.add(new User("王五",9000.0));
        return userList;
    }
}
